#!/usr/bin/env node

const fs       = require('fs'),
      fileName = process.argv[2], 
      log      = console.log;


try{
  let fid  = fs.openSync(fileName,'r'),
      size = fs.statSync(fileName).size,  //得到文件的长度尺寸
      buf  = new Buffer(size);

  fs.readSync(fid,buf,0,size,0); //读取操作

  log(buf.toString('utf8'));

  fs.closeSync(fid); //同步的,Sync
}catch(e){
  log(e.message);
}
